package android.cst.hqu.edu.cn.basemvp.mvp.Presenter;

import android.cst.hqu.edu.cn.basemvp.mvp.Base.BasePresenter;
import android.cst.hqu.edu.cn.basemvp.mvp.Model.UserModel;
import android.cst.hqu.edu.cn.basemvp.mvp.VO.ApiResponse;
import android.cst.hqu.edu.cn.basemvp.mvp.VO.User;
import android.util.Log;

public class LoginPresenter extends BasePresenter<LoginContract.ILoginView> implements LoginContract.ILoginPresenter{

    private final UserModel userModel=new UserModel();

    public LoginPresenter(LoginContract.ILoginView v){
        super.attachView(v);
    }
    @Override
    public void login(User user) {
        userModel.login(user, new LoginContract.IModel.LoginCallback() {
            @Override
            public void onResponse(ApiResponse apiResponse) {

                String code="false";
                code=apiResponse.getCode();
                Log.d("返回响应数据：", apiResponse.getMsg());
                getView().showLoginResult(apiResponse.getMsg());
            }
        });
    }
}
